﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Seesmic.Sdp.Extensibility;

namespace Seesmic.HelloTipi
{
    public class PrivateAction : ITimelineItemAction
    {
        private string _Text;

        public PrivateAction(string username)
        {
            this.Text = string.Format("Répondre en privée à {0}", HelloTipiPlugin.getUserNameOnly(username));
        }

        public bool CanExecute(TimelineItemContainer timelineItemContainer)
        {
            return (timelineItemContainer.TimelineItem is HelloTipiTimeLineItem);
        }

        public void Execute(TimelineItemContainer timelineItemContainer)
        {
            HelloTipiTimeLineItem timelineItem = (HelloTipiTimeLineItem)timelineItemContainer.TimelineItem;

            HelloTipiPlugin.PostingService.SetPostingContainer(new PostContainer(string.Format("d {0}", timelineItem.Username)));
        }


        public DataTemplate Icon
        {
            get
            {
                return HelloTipiPlugin.PrivateActionIcon;
            }
        }

        public string Text
        {
            get
            {
                return this._Text;
            }
            set
            {
                this._Text = value;
            }
        }
    }
}

